package com.rentalHome.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.rentalHome.util.SuperEntity;


/**
 * 用户
 * 
 * @author LeeXyan
 * @date 2017年2月4日 上午9:57:11
 *
 */
@Entity
@Table(name = "user")
public class User extends SuperEntity {
	
	private String username;//账号
	private String password;//密码
	private String email;//注册邮箱
	private String tel;//电话
	private String info;//备注
	
	private Double electPrice;		// 水费单价
	private Double waterPrice;		// 电费单价
	private Double netPrice;		// 网费单价
	
	@OneToMany(mappedBy="user")
	private List<Room> rooms;
	@OneToMany(mappedBy="user")
	private List<Rental> rentals;
	@OneToMany(mappedBy="user")
	private List<Payment> payments;

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	public Double getElectPrice() {
		return electPrice;
	}

	public void setElectPrice(Double electPrice) {
		this.electPrice = electPrice;
	}

	public Double getWaterPrice() {
		return waterPrice;
	}

	public void setWaterPrice(Double waterPrice) {
		this.waterPrice = waterPrice;
	}

	public Double getNetPrice() {
		return netPrice;
	}

	public void setNetPrice(Double netPrice) {
		this.netPrice = netPrice;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public List<Room> getRooms() {
		return rooms;
	}

	@JsonIgnore
	public void setRooms(List<Room> rooms) {
		this.rooms = rooms;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public List<Rental> getRentals() {
		return rentals;
	}

	@JsonIgnore
	public void setRentals(List<Rental> rentals) {
		this.rentals = rentals;
	}

	public List<Payment> getPayments() {
		return payments;
	}

	@JsonIgnore
	public void setPayments(List<Payment> payments) {
		this.payments = payments;
	}


	@Override
	public String toString() {
		return "User{" +
				"username='" + username + '\'' +
				", password='" + password + '\'' +
				", email='" + email + '\'' +
				", tel='" + tel + '\'' +
				", info='" + info + '\'' +
				", electPrice=" + electPrice +
				", waterPrice=" + waterPrice +
				", netPrice=" + netPrice +
				", rooms=" + rooms +
				", rentals=" + rentals +
				", payments=" + payments +
				'}';
	}
}
